class LocalEvent {
    constructor() {
        this.json = {
            header: {
                source_bds_uuid: 'null',
                source_bds_serverName: 'null',
                source_id: null,
            },
            body: {
                data: {},
                metaData: {},
                statusCode: 0,
                statusMessage: ''
            }
        };
    }
    /**
     * 设置WS客户端ID
     * @param {string} id 
     */
    setSourceId(id){
        this.json.header.source_id = id;
        return this;
    }

    /**
     * 设置事件源BDSUUID
     * @param {string} uuid 
     */
    setSourceBdsUuid(uuid){
        this.json.header.source_bds_uuid = uuid;
        return this;
    }

    /**
     * 设置事件源BDS名称
     * @param {string} name 
     */
    setSourceBdsServerName(name){
        this.json.header.source_bds_serverName = name;
        return this;
    }

    /**
     * 设置数据
     * @param {object} data 
     */
    setData(data){
        this.json.body.data = data;
        return this;
    }

    /**
     * 设置元数据
     * @param {object} metaData 
     */
    setMetaData(metaData){
        this.json.body.metaData = metaData;
        return this;
    }

    /**
     * 设置状态码
     * @param {number} statusCode 
     */
    setStatusCode(statusCode){
        this.json.body.statusCode = statusCode;
        return this;
    }

    /**
     * 设置状态消息
     * @param {string} statusMessage 
     */
    setStatusMessage(statusMessage){
        this.json.body.statusMessage = statusMessage;
        return this;
    }
}

module.exports = LocalEvent;